home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 26
/
Cream of the Crop 26.iso
/
program
/
ddj0897.zip
/
DYN401.ZIP
/
class
/
stream.c
< prev
next >
Wrap
C/C++ Source or Header
|
1997-04-16
|
2KB
|
118 lines
/* Copyright (c) 1993-1996 Algorithms Corporation */
/* All rights reserved. */
/* This file automatically generated by dpp - do not edit */
#define DPP_STRATEGY 2
#define DPP_FASTWIDE 0
#line 15 "stream.d"
#include <string.h>
#define CLASS Stream_c
#define ivType Stream_iv_t
#include "generics.h"
object Stream_c;
#line 23 "stream.d"
object stdoutStream_o, stdinStream_o, stderrStream_o, traceStream_o;
imeth int Stream_im_gPuts(object self, char *str)
{
if (IsObj((object)str))
str = gStringValue((object)str);
return gWrite(self, str, strlen(str));
}
imeth int Stream_im_gPutc(object self, int i)
{
char c = (char) i;
return 1 == (gWrite(self, &c, 1)) ? i : EOF;
}
ivmeth int Stream_ivm_vPrintf(object self, va_list _rest_)
{ char * fmt = va_arg(_rest_, char *);
char buf[256];
MAKE_REST(fmt);
vsprintf(buf, fmt, _rest_);
return gWrite(self, buf, strlen(buf));
}
#line 54 "stream.c"
static int Stream_ifm_vPrintf(object self, ...)
{
va_list _rest_;
va_start(_rest_, self);
return Stream_ivm_vPrintf(self, _rest_);
}
#line 48 "stream.d"
imeth objrtn Stream_im_gCopy(object self)
{
return gShouldNotImplement(self, "Copy/DeepCopy");
}
static void class_init(void)
{
Dynace;
RegisterVariable(stdoutStream_o);
RegisterVariable(stderrStream_o);
RegisterVariable(stdinStream_o);
RegisterVariable(traceStream_o);
}
#line 80 "stream.c"
objrtn Stream_initialize(void)
{
static CRITICALSECTION cs;
static int volatile once = 0;
ENTERCRITICALSECTION(_CI_CS_);
if (!once) {
INITIALIZECRITICALSECTION(cs);
once = 1;
}
LEAVECRITICALSECTION(_CI_CS_);
ENTERCRITICALSECTION(cs);
if (Stream_c) {
LEAVECRITICALSECTION(cs);
return Stream_c;
}
INHIBIT_THREADER;
Stream_c = gNewClass(Class, "Stream", 0, 0, END);
iMethodFor(Stream, gPuts, Stream_im_gPuts);
ivMethodFor(Stream, vPrintf, Stream_ivm_vPrintf, Stream_ifm_vPrintf);
iMethodFor(Stream, gPutc, Stream_im_gPutc);
iMethodFor(Stream, gCopy, Stream_im_gCopy);
iMethodFor(Stream, gDeepCopy, Stream_im_gCopy);
class_init();
ENABLE_THREADER;
LEAVECRITICALSECTION(cs);
return Stream_c;
}